package com.lxg.service.firstService.impl;

import com.lxg.dao.AdminDao;
import com.lxg.dao.UserDao;
import com.lxg.pojo.Admin;
import com.lxg.pojo.User;
import com.lxg.service.firstService.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LoginServiceImpl implements LoginService {
    @Autowired
    AdminDao adminDao;
    @Autowired
    UserDao userDao;

    /**
     * 管理员登录
     * @param username
     * @param password
     * @return
     */
    @Override
    public boolean adminLogin(String username, String password) {
        Admin admin = adminDao.getAdmin(username, password);
        if(admin!=null){
            return true;
        }else {
            return false;
        }
    }

    /**
     * 用户登录
     * @param username
     * @param password
     * @return
     */
    @Override
    public boolean userLogin(String username, String password) {
        User user = userDao.getUser(username, password);
        if(user!=null){
            return true;
        }else {
            return false;
        }
    }
}
